Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Workflow Interface] Rename and Refactor WorkspaceExport into NotebookTools #1364

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

refai06
Copy link
Contributor

@refai06 refai06 commented Feb 11, 2025

Description:

This PR refactors WorkspaceExport functionality into distinct classes: NotebookTools and CodeAnalyzer. This change is intended to improve code organization, maintainability, and readability to user.

Change Description:

NotebookTools:

  • The main interface for workspace export and management operations.

  • Handles two export interfaces:

    export(): Aggregator-based workflow export.

    export_federated(): FederatedRuntime-specific export.

  • Responsible for generating configuration and requirements files.

CodeAnalyzer:

  • A dedicated helper class for code analysis and transformation.

  • Provides utilities for converting notebooks to Python scripts, analysing and extracting key information, including flow details, configurations, runtime details.

Note:

  • NotebookTools provides the user interface (for Aggregator based workflow) and internally utilizes the CodeAnalyzer class.

  • NotebookTools replaces the WorkspaceExport module.

Deleted:

  • openfl/experimental/workflow/workspace_export/export.py

Files Added:

  • openfl/experimental/workflow/notebooktools/notebook_tools.py
  • openfl/experimental/workflow/notebooktools/code_analyzer.py

Files Modified:

  • openfl-tutorials/experimental/workflow/1001_Workspace_Creation_from_JupyterNotebook.ipynb
  • openfl-tutorials/experimental/workflow/Vertical_FL/TwoPartyWorkspaceCreation.ipynb
  • openfl/experimental/workflow/interface/cli/workspace.py
  • openfl/experimental/workflow/runtime/federated_runtime.py

Verification:

Following tutorials are validated to ensure the refactoring is working fine

  • openfl-tutorials/experimental/workflow/FederatedRuntime/301_MNIST_Watermaking
  • openfl-tutorials/experimental/workflow/1001_Workspace_Creation_from_JupyterNotebook.ipynb

Test Case:

Following test cases are added which validates the NotebookTools export() and export_federated() functionality

  • tests/openfl/experimental/workflow/NotebookTools/tescase_export
  • tests/openfl/experimental/workflow/NotebookTools/testcase_export_federated

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could having an overloaded NotebookTools.export function contribute to a more streamlined user interface? With the introduction of SecureFederatedRuntime (and other runtime environments in the future), users could leverage a single export call (with varying parameters), allowing the system to internally determine the appropriate export flow for each runtime.

@refai06 refai06 marked this pull request as ready for review February 20, 2025 12:56
@refai06 refai06 changed the title [WIP] [Workflow Interface] Rename and Refactor WorkspaceExport into NotebookTools [Workflow Interface] Rename and Refactor WorkspaceExport into NotebookTools Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants